If an onComplete handler is passed to animate(), it is set to run at
the end of the animation via the icon grid's ::animation-done signal.
Currently the signal is connected after starting the animation, with
the result that the handler doesn't run when the animation completes
immediately (because there are no icons to animate). Fix this by only
starting the animation after connecting the signal.
https://bugzilla.gnome.org/show_bug.cgi?id=774381
},
animate: function(animationDirection, onComplete) {
+ if (onComplete) {
+ let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
+ function () {
+ this._grid.disconnect(animationDoneId);
+ onComplete();
+ }));
+ }
+
if (animationDirection == IconGrid.AnimationDirection.IN) {
let toAnimate = this._grid.actor.connect('notify::allocation', Lang.bind(this,
function() {
} else {
this._doSpringAnimation(animationDirection);
}
-
- if (onComplete) {
- let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
- function () {
- this._grid.disconnect(animationDoneId);
- onComplete();
- }));
- }
},
animateSwitch: function(animationDirection) {